﻿<UserControl x:Class="SystemModule.Views.AddUserView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:telerikDragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="720" d:DesignWidth="900">
    <UserControl.Resources>
        <!--<ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Infrastructure;component/Themes/CommonTemplates.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>-->
        <DataTemplate x:Key="ItemTemplate">
            <TextBlock Text="{Binding TenGoi}" />
        </DataTemplate>

        <Style x:Key="DraggableListBoxItem" TargetType="telerik:RadListBoxItem">
            <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel>
            <TextBlock Margin="40,10,0,0" Text="Thêm mới người dùng" 
                       FontWeight="Bold" Foreground="#FF7A7A7A" HorizontalAlignment="Left"  FontFamily="Segoe UI" FontSize="16" />
            <Rectangle Fill="#FFD6D6D6" Height="1" Margin="0,10 0,15" />
        </StackPanel>
        <Grid  Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="135" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <TextBlock Text="Tên tài khoản:" Grid.Row="0" />
            <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding TenTaiKhoan,Mode=TwoWay}" />

            <TextBlock Text="Đơn vị:" Grid.Row="1"/>
            <telerik:RadComboBox Grid.Column="1" Grid.Row="1" Name="radComboBox1" Margin="0,0,0,15"
                                     SelectedItem="{Binding CurrentDonVi, Mode=TwoWay}" ItemsSource="{Binding DonViList}"
                                     DisplayMemberPath="TenGoi" />
            <TextBlock Text="Quyền:" Grid.Row="2" />
            <StackPanel Grid.Column="1" Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
                <Border Height="200">
                    <telerik:RadListBox AllowDrop="True" x:Name="listBox1"
                 ItemContainerStyle="{StaticResource DraggableListBoxItem}"
                                ItemsSource="{Binding UserQuyenList}"
                 DisplayMemberPath="TenGoi" Width="200">
                        <telerik:RadListBox.DragVisualProvider>
                            <telerik:ScreenshotDragVisualProvider />
                        </telerik:RadListBox.DragVisualProvider>
                        <telerik:RadListBox.DragDropBehavior>
                            <telerik:ListBoxDragDropBehavior />
                        </telerik:RadListBox.DragDropBehavior>
                    </telerik:RadListBox>
                </Border>
                <Border Grid.Column="1">
                    <telerik:RadListBox  AllowDrop="True" ItemsSource="{Binding QuyenList}"
                            ItemContainerStyle="{StaticResource DraggableListBoxItem}"
							Width="200"
                                 DisplayMemberPath="TenGoi">
                        <telerik:RadListBox.DragVisualProvider>
                            <telerik:ScreenshotDragVisualProvider />
                        </telerik:RadListBox.DragVisualProvider>
                        <telerik:RadListBox.DragDropBehavior>
                            <telerik:ListBoxDragDropBehavior AllowReorder="True" />
                        </telerik:RadListBox.DragDropBehavior>
                    </telerik:RadListBox>
                </Border>
            </StackPanel>
            <StackPanel Grid.Column="1" Grid.Row="8" Orientation="Horizontal" HorizontalAlignment="Right">
                <telerik:RadButton Content="Lưu lại" HorizontalAlignment="Right" Name="radButton1" Width="75" Command="{Binding AddNewCommand}" />
                <telerik:RadButton Content="Hủy bỏ" HorizontalAlignment="Right" Name="radButton2" Width="75" Command="{Binding CancelCommand}"/>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>
